﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUSService;
using DTOService;

namespace QuanLyBangDia
{
    public partial class frmMain : Form
    {
        MyService myService = new MyService();

        public frmMain()
        {
            InitializeComponent();
            this.Icon = QuanLyBangDia.Properties.Resources.HDD;
            this.btnThueBangDia.Image = QuanLyBangDia.Properties.Resources.leftdisk;
            this.btnTraBangDia.Image = QuanLyBangDia.Properties.Resources.rightdisk;
            this.btnTimKiem.Image = QuanLyBangDia.Properties.Resources.Search_disk;
            this.btnQuanLyHeThong.Image = QuanLyBangDia.Properties.Resources.advancedsettings;
            this.btnQuanLyKhachHang.Image = QuanLyBangDia.Properties.Resources.User_Group_icon;
            this.btnQuanLyDoanhThu.Image = QuanLyBangDia.Properties.Resources.coins_icon;
            this.btnQuanLyBangDia.Image = QuanLyBangDia.Properties.Resources.Configuration_Disc_icon;
            this.btnThongKeBangDia.Image = QuanLyBangDia.Properties.Resources.chart_search_icon;
            gvMain.Columns.Add("MaBD","Mã Băng Đĩa");
            gvMain.Columns.Add( "TenBD","Tên Băng Đĩa");
            gvMain.Columns.Add("GiaBD","Giá Trị Băng Đĩa");
            gvMain.Columns.Add("MoTa","Mô Tả Băng Đĩa");
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            BangDia[] ls = myService.SelectBangDiaThueNhieuNhat();
            object[] temp;
            foreach (BangDia v in ls)
            {
                temp = new object[] { v.MaBD,v.TenBD,v.GiaBD,v.MoTa };
                gvMain.Rows.Add(temp);
            }
            gvMain.Show();
        }

        private void btnTraBangDia_Click(object sender, EventArgs e)
        {
            frmTraBangDia frmTBD = new frmTraBangDia();
            frmTBD.ShowDialog();
        }

        private void btnThueBangDia_Click(object sender, EventArgs e)
        {
            frmThueBangDia frmThue = new frmThueBangDia();
            frmThue.ShowDialog();
        }
       
        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            frmTimKiemBangDia frmTKBD = new frmTimKiemBangDia();
            frmTKBD.ShowDialog();

        }

        private void btiQuanLyBangDia_Click(object sender, EventArgs e)
        {
            frmQuanLyBangDia frm = new frmQuanLyBangDia();
            frm.ShowDialog();
        }

        private void btiQuanLyLoaiSanPham_Click(object sender, EventArgs e)
        {
            frmQuanLyLoaiSanPham frm = new frmQuanLyLoaiSanPham();
            frm.ShowDialog();
        }

        private void btiQuanLyLoaiBangDia_Click(object sender, EventArgs e)
        {
            frmQuanLyLoaiBangDia frm = new frmQuanLyLoaiBangDia();
            frm.ShowDialog();
        }

        private void btiQuanLyTinhTrangBangDia_Click(object sender, EventArgs e)
        {
            frmQuanLyTinhTrangBangDia frm = new frmQuanLyTinhTrangBangDia();
            frm.ShowDialog();
        }

        private void btiGhiNhanMat_Click(object sender, EventArgs e)
        {
            frmGhiNhanMatSanPham frm = new frmGhiNhanMatSanPham();
            frm.ShowDialog();
        }

        private void btnQuanLyKhachHang_Click(object sender, EventArgs e)
        {
            frmQuanLyKhachHang frm = new frmQuanLyKhachHang();
            frm.ShowDialog();
        }

        private void btiThongKeBangDiaQuaHan_Click(object sender, EventArgs e)
        {
            frmBangDiaThueQuaHan frm = new frmBangDiaThueQuaHan();
            frm.ShowDialog();
        }

        private void btiThongKeBangDiaThueNhieu_Click(object sender, EventArgs e)
        {
            frmBangDiaThueNhieu frm = new frmBangDiaThueNhieu();
            frm.ShowDialog();
        }

        private void btiThayDoiQuyDinh_Click(object sender, EventArgs e)
        {
            frmThayDoiQuyDinh frm = new frmThayDoiQuyDinh();
            frm.ShowDialog();
        }

        private void btnThongKe_Click(object sender, EventArgs e)
        {
            frmQuanLyDoanhThu frm = new frmQuanLyDoanhThu();
            frm.ShowDialog(); 
        }

    }
}
